<%@tag description="put the tag description here" pageEncoding="UTF-8"%>
<%@ include file="/taglibs.jsp" %>

<%@attribute name="items" required="true" type="java.util.Collection"%>
<%@attribute name="resultName" required="true"%>

<table>
    <c:set var="setSize" value="${fn:length(items)}"/>
    <c:forEach items="${items}" var="i" varStatus="row">
        <c:if test="${row.index % 3 == 0}">
            <tr>
        </c:if>
        <td><s:label name="${resultName}['${i.id}']">${i.name}:</s:label></td>
        <td><s:checkbox name="${resultName}['${i.id}']"/></td>
        <c:if test="${row.index % 3 == 2}">
            </tr>
        </c:if>
    </c:forEach>
    <c:if test="${setSize % 3 != 0}">
        <c:forEach begin = "1" end = "${3 - (setSize % 3)}">
            <td></td>
        </c:forEach>
        </tr>
    </c:if>
</table>
